

import 'dart:io';

import 'package:device_info/device_info.dart';
import 'package:package_info/package_info.dart';
/// 是否是生产环境
const bool inProduction = const bool.fromEnvironment("dart.vm.product");
class PlatformUtils{

  static String getPlatform()=>Platform.operatingSystem;


  static bool isAndroid() => Platform.isAndroid;

  static bool isIos() => Platform.isIOS;

  static String getFlutterVersion() => Platform.version;

  static Future<PackageInfo> getAppPackageInfo(){
    return PackageInfo.fromPlatform();
  }

  static Future<String> getAppVersion() async{
    var packageInfo = await PackageInfo.fromPlatform();
    return packageInfo.version;
  }


  static Future getDeviceInfo() async{
    var deviceInfo = DeviceInfoPlugin();
    if(isAndroid()){
      return await deviceInfo.androidInfo;
    }else if(isIos()){
      return await deviceInfo.iosInfo;
    }else{
      return null;
    }
  }
}